package duiXiangshuzu;

import java.util.ArrayList;

public class demo03 {
    public static void main(String[] args) {
        ArrayList <Stu> s = new ArrayList<>();
        Stu one = new Stu("jack",19);
        Stu two = new Stu("peter",89);
        Stu three = new Stu("rose",90);
        Stu four = new Stu("parker",98);

        s.add(one);
        s.add(two);
        s.add(three);
        s.add(four);
        //这是省略写法
        for (Stu stu : s) {
            System.out.println(stu.getName()+stu.getAge());
        }
    }
}
